/*
 thumb_db.c
 
 http://code.google.com/p/armstorm/
 distorm at gmail dot com
 Copyright (C) 2012 Gil Dabah
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>
*/

#include "armstorm.h"
#include "thumb_db.h"

typedef enum
{
	/* THUMBv1 Instruction Set */
	TM_ADC,
	TM_ADD1, TM_ADD2, TM_ADD3, TM_ADD4,
	TM_ADD5, TM_ADD6, TM_ADD7,
	TM_AND, TM_ASR1, TM_ASR2,
	TM_BEQ, TM_BNE, TM_BCS, TM_BCC,
	TM_BMI, TM_BPL, TM_BVS, TM_BVC,
	TM_BHI, TM_BLS, TM_BGE, TM_BLT,
	TM_BGT, TM_BLE, TM_BAL,
	TM_B2, TM_BIC, TM_BL, TM_BX,
	TM_CMN, TM_CMP1, TM_CMP2, TM_CMP3,	
	TM_EOR,	TM_LDMIA,
	TM_LDR1, TM_LDR2, TM_LDR3, TM_LDR4,
	TM_LDRB1, TM_LDRB2, TM_LDRH1, TM_LDRH2,
	TM_LDRSB, TM_LDRSH,
	TM_LSL1, TM_LSL2, TM_LSR1, TM_LSR2,
	TM_MOV1, TM_MOV2, TM_MOV3,
	TM_MUL, TM_MVN, TM_NEG, TM_ORR, 
	TM_POP, TM_PUSH, TM_ROR, TM_SBC,
	TM_STMIA, TM_STR1, TM_STR2, TM_STR3,
	TM_STRB1, TM_STRB2, TM_STRH1, TM_STRH2,		
	TM_SUB1, TM_SUB2, TM_SUB3, TM_SUB4,
	TM_SWI, TM_TST,
	
	/* THUMBv2 Extension Instructions */
	TM_BKPT,
	TM_BLX1, TM_BLX2,
	
	/* THUMBv3 Extension Instructions */
	TM_CPS, TM_CPY,
	TM_REV, TM_REV16, TM_REVSH,
	TM_SETEND,
	TM_SXTB, TM_SXTH,
	TM_UXTB, TM_UXTH,
	
	/* End Mnemonic to Get Mnemonic Count */
	MNEM_END
	
} _ThumbMnemIndex;

_ThumbInstInfo ThumbInstructions[] = {
	/* THUMBv1 Instruction Set */
	/* ADC */ {I_ADC, 0, OT_RD, OT_RM3, OT_NONE},
	/* ADD1 */ {I_ADD, 0, OT_RD, OT_RN3, OT_IMM3_6},
	/* ADD2 */ {I_ADD, 0, OT_RD8, OT_IMM8, OT_NONE},
	/* ADD3 */ {I_ADD, 0, OT_RD, OT_RN3, OT_RM6},
	/* ADD4 */ {I_ADD, 0, OT_HRD, OT_HRM3, OT_NONE},
	/* ADD5 */ {I_ADD, 16, OT_PC, OT_RD8, OT_IMM8},
	/* ADD6 */ {I_ADD, 16, OT_SP, OT_RD8, OT_IMM8},
	/* ADD7 */ {I_ADD, 16, OT_SP, OT_IMM7, OT_NONE},
	/* AND */ {I_AND, 0, OT_RD, OT_RM3, OT_NONE},
	/* ASR1 */ {I_ASR, 0, OT_RD, OT_RM3, OT_IMM5},
	/* ASR2 */ {I_ASR, 0, OT_RD, OT_RS3, OT_NONE},
	/* BEQ */ {I_BEQ, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BNE */ {I_BNE, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BCS */ {I_BCS, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BCC */ {I_BCC, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BMI */ {I_BMI, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BPL */ {I_BPL, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BVS */ {I_BVS, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BVC */ {I_BVC, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BHI */ {I_BHI, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BLS */ {I_BLS, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BGE */ {I_BGE, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BLT */ {I_BLT, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BGT */ {I_BGT, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BLE */ {I_BLE, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* BAL */ {I_BAL, 0, OT_OFF8, OT_NONE, OT_NONE},
	/* B2 */ {I_B, 0, OT_OFF11, OT_NONE, OT_NONE},
	/* BIC */ {I_BIC, 0, OT_RD, OT_RM3, OT_NONE},
	/* BL */ {I_BL, 0, OT_OFF11, OT_NONE, OT_NONE},
	/* BX */ {I_BX, 0, OT_HRM3, OT_SBZ3_0, OT_NONE},
	/* CMN */ {I_CMN, 0, OT_RD, OT_RM3, OT_NONE},
	/* CMP1 */ {I_CMP, 0, OT_RN8, OT_IMM8, OT_NONE},
	/* CMP2 */ {I_CMP, 0, OT_RN0, OT_RM3, OT_NONE},
	/* CMP3 */ {I_CMP, 0, OT_HRN0, OT_HRM3, OT_NONE},
	/* EOR */ {I_EOR, 0, OT_RD, OT_RM3, OT_NONE},
	/* LDMIA */ {I_LDMIA, 0, OT_RN8, OT_REGLIST, OT_NONE},
	/* LDR1 */ {I_LDR, 18, OT_RD, OT_RN3, OT_IMM5_6},
	/* LDR2 */ {I_LDR, 2, OT_RD, OT_RN3, OT_RM6},
	/* LDR3 */ {I_LDR, 18, OT_RD8, OT_PC, OT_IMM8},
	/* LDR4 */ {I_LDR, 18, OT_RD8, OT_SP, OT_IMM8},
	/* LDRB1 */ {I_LDRB, 2, OT_RD, OT_RN3, OT_IMM5_6},
	/* LDRB2 */ {I_LDRB, 2, OT_RD, OT_RN3, OT_RM6},
	/* LDRH1 */ {I_LDRH, 18, OT_RD, OT_RN3, OT_IMM5_6},
	/* LDRH2 */ {I_LDRH, 2, OT_RD, OT_RN3, OT_RM6},
	/* LDRSB */ {I_LDRSB, 2, OT_RD, OT_RN3, OT_RM6},
	/* LDRSH */ {I_LDRSH, 2, OT_RD, OT_RN3, OT_RM6},
	/* LSL1 */ {I_LSL, 0, OT_RD, OT_RM3, OT_IMM5},
	/* LSL2 */ {I_LSL, 0, OT_RD, OT_RS3, OT_NONE},
	/* LSR1 */ {I_LSR, 0, OT_RD, OT_RM3, OT_IMM5},
	/* LSR2 */ {I_LSR, 0, OT_RD, OT_RS3, OT_NONE},
	/* MOV1 */ {I_MOV, 0, OT_RD8, OT_IMM8, OT_NONE},
	/* MOV2 */ {I_MOV, 0, OT_RD, OT_RN3, OT_NONE},
	/* MOV3 */ {I_MOV, 0, OT_HRD, OT_HRM3, OT_NONE},
	/* MUL */ {I_MUL, 0, OT_RD, OT_RM3, OT_NONE},
	/* MVN */ {I_MVN, 0, OT_RD, OT_RM3, OT_NONE},
	/* NEG */ {I_NEG, 0, OT_RD, OT_RM3, OT_NONE},
	/* ORR */ {I_ORR, 0, OT_RD, OT_RM3, OT_NONE},
	/* POP */ {I_POP, 0, OT_REGLIST, OT_PC8, OT_NONE},
	/* PUSH */ {I_PUSH, 0, OT_REGLIST, OT_LR8, OT_NONE},
	/* ROR */ {I_ROR, 0, OT_RD, OT_RS3, OT_NONE},
	/* SBC */ {I_SBC, 0, OT_RD, OT_RM3, OT_NONE},
	/* STMIA */ {I_STMIA, 0, OT_RN8, OT_REGLIST, OT_NONE},
	/* STR1 */ {I_STR, 18, OT_RD, OT_RN3, OT_IMM5_6},
	/* STR2 */ {I_STR, 18, OT_RD, OT_RN3, OT_RM6},
	/* STR3 */ {I_STR, 18, OT_RD8, OT_SP, OT_IMM8},
	/* STRB1 */ {I_STRB, 2, OT_RD, OT_RN3, OT_IMM5_6},
	/* STRB2 */ {I_STRB, 2, OT_RD, OT_RN3, OT_RM6},
	/* STRH1 */ {I_STRH, 18, OT_RD, OT_RN3, OT_IMM5_6},
	/* STRH2 */ {I_STRH, 2, OT_RD, OT_RN3, OT_RM6},
	/* SUB1 */ {I_SUB, 0, OT_RD, OT_RN3, OT_IMM3_6},
	/* SUB2 */ {I_SUB, 0, OT_RD8, OT_IMM8, OT_NONE},
	/* SUB3 */ {I_SUB, 0, OT_RD, OT_RN3, OT_RM6},
	/* SUB4 */ {I_SUB, 16, OT_SP, OT_IMM7, OT_NONE},
	/* SWI */ {I_SWI, 0, OT_IMM8, OT_NONE, OT_NONE},
	/* TST */ {I_TST, 0, OT_RN0, OT_RM3, OT_NONE},
		
	/* THUMBv2 Instruction Set */
	/* BKPT */ {I_BKPT, 0, OT_IMM8, OT_NONE, OT_NONE},
	/* BLX1 */ {I_BLX, 0, OT_IMM8, OT_NONE, OT_NONE},
	/* BLX2 */ {I_BLX, 0, OT_HRM3, OT_SBZ3_0, OT_NONE},

	/* THUMBv3 Instruction Set */
	/* CPS */ {I_CPS, 0, OT_NONE, OT_NONE, OT_NONE},
	/* CPY */ {I_CPY, 0, OT_NONE, OT_NONE, OT_NONE},
	/* REV */ {I_REV, 0, OT_RD, OT_RN3, OT_NONE},
	/* REV16 */ {I_REV16, 0, OT_RD, OT_RN3, OT_NONE},
	/* REVSH */ {I_REVSH, 0, OT_RD, OT_RN3, OT_NONE},
	/* SETEND */ {I_SETEND, 0, OT_NONE, OT_NONE, OT_NONE},
	/* SXTB */ {I_SXTB, 0, OT_RD, OT_RM3, OT_NONE},
	/* SXTH */ {I_SXTH, 0, OT_RD, OT_RM3, OT_NONE},
	/* UXTB */ {I_UXTB, 0, OT_RD, OT_RM3, OT_NONE},
	/* UXTH */ {I_UXTH, 0, OT_RD, OT_RM3, OT_NONE}
};

unsigned char ThumbsIds[] = {
    /* 0x000 */ TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1,
    /* 0x010 */ TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1, TM_LSL1,
    /* 0x020 */ TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1,
    /* 0x030 */ TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1, TM_LSR1,
    /* 0x040 */ TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1,
    /* 0x050 */ TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1, TM_ASR1,
    /* 0x060 */ TM_ADD3, TM_ADD3, TM_ADD3, TM_ADD3, TM_ADD3, TM_ADD3, TM_ADD3, TM_ADD3, TM_SUB3, TM_SUB3, TM_SUB3, TM_SUB3, TM_SUB3, TM_SUB3, TM_SUB3, TM_SUB3,
    /* 0x070 */ TM_MOV2, TM_ADD1, TM_ADD1, TM_ADD1, TM_ADD1, TM_ADD1, TM_ADD1, TM_ADD1, TM_SUB1, TM_SUB1, TM_SUB1, TM_SUB1, TM_SUB1, TM_SUB1, TM_SUB1, TM_SUB1,
    /* 0x080 */ TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1,
    /* 0x090 */ TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1, TM_MOV1,
    /* 0x0A0 */ TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1,
    /* 0x0B0 */ TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1, TM_CMP1,
    /* 0x0C0 */ TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2,
    /* 0x0D0 */ TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2, TM_ADD2,
    /* 0x0E0 */ TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2,
    /* 0x0F0 */ TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2, TM_SUB2,
    /* 0x100 */ TM_AND, TM_EOR, TM_LSL2, TM_LSR2, TM_ASR2, TM_ADC, TM_SBC, TM_ROR, TM_TST, TM_NEG, TM_CMP2, TM_CMN, TM_ORR, TM_MUL, TM_BIC, TM_MVN,
    /* 0x110 */ TM_ADD4, TM_ADD4, TM_ADD4, TM_ADD4, TM_CMP3, TM_CMP3, TM_CMP3, TM_CMP3, TM_MOV3, TM_MOV3, TM_MOV3, TM_MOV3, TM_BX, TM_BX, TM_BLX2, TM_BLX2,
    /* 0x120 */ TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3,
    /* 0x130 */ TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3, TM_LDR3,
    /* 0x140 */ TM_STR2, TM_STR2, TM_STR2, TM_STR2, TM_STR2, TM_STR2, TM_STR2, TM_STR2, TM_STRH2, TM_STRH2, TM_STRH2, TM_STRH2, TM_STRH2, TM_STRH2, TM_STRH2, TM_STRH2,
    /* 0x150 */ TM_STRB2, TM_STRB2, TM_STRB2, TM_STRB2, TM_STRB2, TM_STRB2, TM_STRB2, TM_STRB2, TM_LDRSB, TM_LDRSB, TM_LDRSB, TM_LDRSB, TM_LDRSB, TM_LDRSB, TM_LDRSB, TM_LDRSB,
    /* 0x160 */ TM_LDR2, TM_LDR2, TM_LDR2, TM_LDR2, TM_LDR2, TM_LDR2, TM_LDR2, TM_LDR2, TM_LDRH2, TM_LDRH2, TM_LDRH2, TM_LDRH2, TM_LDRH2, TM_LDRH2, TM_LDRH2, TM_LDRH2,
    /* 0x170 */ TM_LDRB2, TM_LDRB2, TM_LDRB2, TM_LDRB2, TM_LDRB2, TM_LDRB2, TM_LDRB2, TM_LDRB2, TM_LDRSH, TM_LDRSH, TM_LDRSH, TM_LDRSH, TM_LDRSH, TM_LDRSH, TM_LDRSH, TM_LDRSH,
    /* 0x180 */ TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1,
    /* 0x190 */ TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1, TM_STR1,
    /* 0x1A0 */ TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1,
    /* 0x1B0 */ TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1, TM_LDR1,
    /* 0x1C0 */ TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1,
    /* 0x1D0 */ TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1, TM_STRB1,
    /* 0x1E0 */ TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1,
    /* 0x1F0 */ TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1, TM_LDRB1,
    /* 0x200 */ TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1,
    /* 0x210 */ TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1, TM_STRH1,
    /* 0x220 */ TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1,
    /* 0x230 */ TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1, TM_LDRH1,
    /* 0x240 */ TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3,
    /* 0x250 */ TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3, TM_STR3,
    /* 0x260 */ TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4,
    /* 0x270 */ TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4, TM_LDR4,
    /* 0x280 */ TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5,
    /* 0x290 */ TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5, TM_ADD5,
    /* 0x2A0 */ TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6,
    /* 0x2B0 */ TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6, TM_ADD6,
    /* 0x2C0 */ TM_ADD7, TM_ADD7, TM_SUB4, TM_SUB4, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x4c, 0x4d, 0x4e, 0xff, 0xff, 0xff, 0xff,
    /* 0x2D0 */ TM_PUSH, TM_PUSH, TM_PUSH, TM_PUSH, TM_PUSH, TM_PUSH, TM_PUSH, TM_PUSH, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    /* 0x2E0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4f, 0x50, 0xff, 0x51, 0xff, 0xff, 0xff, 0xff,
    /* 0x2F0 */ TM_POP, TM_POP, TM_POP, TM_POP, TM_POP, TM_POP, TM_POP, TM_POP, TM_BKPT, TM_BKPT, TM_BKPT, TM_BKPT, 0xff, 0xff, 0xff, 0xff,
    /* 0x300 */ TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA,
    /* 0x310 */ TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA, TM_STMIA,
    /* 0x320 */ TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA,
    /* 0x330 */ TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA, TM_LDMIA,
    /* 0x340 */ TM_BEQ, TM_BEQ, TM_BEQ, TM_BEQ, TM_BNE, TM_BNE, TM_BNE, TM_BNE, TM_BCS, TM_BCS, TM_BCS, TM_BCS, TM_BCC, TM_BCC, TM_BCC, TM_BCC,
    /* 0x350 */ TM_BMI, TM_BMI, TM_BMI, TM_BMI, TM_BPL, TM_BPL, TM_BPL, TM_BPL, TM_BVS, TM_BVS, TM_BVS, TM_BVS, TM_BVC, TM_BVC, TM_BVC, TM_BVC,
    /* 0x360 */ TM_BHI, TM_BHI, TM_BHI, TM_BHI, TM_BLS, TM_BLS, TM_BLS, TM_BLS, TM_BGE, TM_BGE, TM_BGE, TM_BGE, TM_BLT, TM_BLT, TM_BLT, TM_BLT,
    /* 0x370 */ TM_BGT, TM_BGT, TM_BGT, TM_BGT, TM_BLE, TM_BLE, TM_BLE, TM_BLE, TM_BAL, TM_BAL, TM_BAL, TM_BAL, TM_SWI, TM_SWI, TM_SWI, TM_SWI,
    /* 0x380 */ TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2,
    /* 0x390 */ TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2, TM_B2,
    /* 0x3A0 */ TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1,
    /* 0x3B0 */ TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1, TM_BLX1,
    /* 0x3C0 */ TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL,
    /* 0x3D0 */ TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL,
    /* 0x3E0 */ TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL,
    /* 0x3F0 */ TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL, TM_BL,
};
